<?php
declare (strict_types = 1);

namespace app\middlewares;

use think\Response;

class AdminAuth {
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response|\think\response\Redirect
     */
    public function handle($request, \Closure $next) {
        if(!session('adminId')) {
            return redirect('/admin/index');
        }
        return $next($request);
    }
}
